<!-- TS 标注类型 -->
<script lang="ts" setup>
import { defineComponent } from 'vue'

import componentProps from './props.vue'
import componentEmits from './emits.vue'
import componentRef from './ref.vue'
import componentReactive from './reactive.vue'
import componentComputed from './computed.vue'
import componentEventFn from './eventFn.vue'

defineComponent({
  components: {
    componentProps,
    componentEmits,
    componentRef,
    componentReactive,
    componentComputed,
    componentEventFn,
  },
})
function callback() {
  console.log('callback')
}
</script>

<template>
  <div>为组件的props标注类型，设置默认值</div>
  <div>
    <componentProps :bar="2" :foo="'2'"></componentProps>
    <componentProps></componentProps>
  </div>
  <div>为组件的emits标注类型</div>
  <div>
    <componentEmits @some-event="callback"></componentEmits>
  </div>
  <div>为ref()标注类型</div>
  <div>
    <componentRef></componentRef>
  </div>
  <div>为reactive()标注类型</div>
  <div>
    <componentReactive></componentReactive>
  </div>
  <div>为computed()标注类型</div>
  <div>
    <componentComputed></componentComputed>
  </div>
  <div>为事件处理函数标注类型</div>
  <div>
    <componentEventFn></componentEventFn>
  </div>
</template>

<style lang="scss" scoped></style>
